#include<stdio.h>  

int main() {
	int jiecheng(int n);
	int n;
	jiecheng(n);
	return 0;
}

int jiecheng(int n) {
	int a;
	int jianji(int p);
	scanf("%d", &a);
	while (a--) {
		if (a > 20 || a < 0)
			return -1;
		scanf("%d", &n);
		if (n > 20 || n <= 0)
			return -1;
		int sum = 0, num = 1;
		for (int i = 1; i <= n; i++) {
			if (jianji(i) == 1) {
				num *= i;
			}
			sum += num;
		}
		printf("%d\n", sum);
	}
	return 0;
}

int jianji(int p) {
	if (p % 2 == 0)
		return -1;
	else
		return 1;
}
